GtkNotebook: fix crash when DnD tabs between windows
authorXan Lopez <xan@igalia.com>
Fri, 30 Dec 2011 20:09:21 +0000 (21:09 +0100)
committerXan Lopez <xan@igalia.com>
Wed, 4 Jan 2012 07:48:46 +0000 (08:48 +0100)
When doing DnD between windows the tab label is set as the child of
the DnD info window. If this is happening the remove method of
GtkNotebook should not unparent the tab label, since it's been already
unparented, belongs to the DnD window and will be properly destroyed
when the DnD is over.

https://bugzilla.gnome.org/show_bug.cgi?id=639875

gtk/gtknotebook.c

index 32cdee71ee714d783f7f3547f20384b56c679f85..231893f74c04cd5744dcc9e8610f3280e48772c9 100644 (file)
@@ -4958,7 +4958,10 @@ gtk_notebook_real_remove (GtkNotebook *notebook,
   gtk_widget_unparent (page->child);
 
   tab_label = page->tab_label;
-  if (tab_label)
+  /* Do not unparent the tab label if it's already in another
+     hierarchy. It means we are in the middle of a DnD and it's
+     already taken care of. */
+  if (tab_label && NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, page))
     {
       g_object_ref (tab_label);
       gtk_notebook_remove_tab_label (notebook, page);